package com.gohome.gohomechat.presenter;

import com.gohome.gohomechat.model.NoticeModel;
import com.gohome.gohomechat.model.entify.Notice;
import com.gohome.gohomechat.model.modellistener.NoticeModelInterface;
import com.gohome.gohomechat.presenter.callback.NoticeAgreeCallBack;
import com.gohome.gohomechat.presenter.callback.NoticeCallBack;
import com.gohome.gohomechat.presenter.callback.NoticeRefusedCallBack;
import com.gohome.gohomechat.presenter.presenterlistener.NoticePresenterInterface;
import com.gohome.gohomechat.ui.viewlistener.NoticeViewInterface;

import java.util.List;

/**
 * Created by dllo on 16/3/3.
 */
public class NoticePresenter extends BasePresenter<NoticeViewInterface> implements NoticePresenterInterface {
    private NoticeViewInterface noticeViewInterface;
    private NoticeModelInterface noticeModelInterface;

    public NoticePresenter(NoticeViewInterface noticeViewInterface) {
        this.noticeViewInterface = noticeViewInterface;
        this.noticeModelInterface=new NoticeModel();
    }

    @Override
    public void refreshData() {
        noticeModelInterface.requestData(new NoticeCallBack() {
            @Override
            public void onScuess(List<Notice> datas) {
                noticeViewInterface.refreshData(datas);
            }

            @Override
            public void onFailed() {
                noticeViewInterface.refreshDataFailed();
            }
        });

    }

    @Override
    public void agreeFriendRequest(String userName) {
        noticeModelInterface.agreeFriendRequest(userName, new NoticeAgreeCallBack() {
            @Override
            public void onScuess() {

            }

            @Override
            public void onFailed() {

            }
        });
    }

    @Override
    public void refusedFriendRequest(String userName) {
        noticeModelInterface.refusedFriendRequest(userName, new NoticeRefusedCallBack() {
            @Override
            public void onScuess() {
            }

            @Override
            public void onFailed() {

            }
        });
    }
}
